import Vue from 'vue' // 引入vue
import VueRouter from 'vue-router' // 使用VueRouter

// 引入所有一级路由对应的页面
import Find from '@/pages/Find'
import My from '@/pages/My'
import Part from '@/pages/Part'
import NotFound from '@/pages/NotFound'

// 引入所有二级路由对应的页面
import Ranking from '@/pages/Second/Ranking'
import SongList from '@/pages/Second/SongList'
import Recommend from '@/pages/Second/Recommend'



// 应用路由 使用路由插件
Vue.use(VueRouter)

//路由表
const routes = [
  {
    path:"/", // 网站默认hash值  默认页面  监测默认路由
    redirect:Find // 重定向 显示Find页面
  },
  {
    path:"/find",
    component:Find,
    // 配置二级路由
    children:[
      {
        path:"/",
        component:Recommend,
      },
      {
        path:"recommend",
        component:Recommend,
      },
      {
        path:"songList",
        component:SongList,
      },
      {
        path:"ranking",
        component:Ranking,
      },
    ]
  },
  {
    path:"/my",
    component:My
  },
  {
    path:"/part",
    component:Part
  },
  {
    path:"/*",
    component:NotFound
  }
  
]

// 创建路由器对象
const router = new VueRouter({
  mode: 'history', // 路由模式
  routes
})

export default router
